{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}


{% block page_content %}
<div class="row">
	<div class="col-lg-6">
	<a class="btn btn-info" href="{{ url_for('add_user') }}">添加新考生</a>
	</div>
<form class="form-inline" method="post" role="form">
	{{ form.hidden_tag() }}
	{{ wtf.form_errors(form, hiddens="True") }}
	<div class="col-lg-6">
	<div class="input-group">
	{{ form.number(class="form-control", placeholder="输入考号查询考生") }}
	<span class="input-group-btn">
	{{ wtf.form_field(form.submit) }}
	</span>
	</div>
	</div>
</form>
</div>
<!--用户列表-->
{% if students %}
<table class="table table-striped table-condensed">
	<thead>
		<tr>
			<th>身份</th>
			<th>考号</th>
			<th>姓名</th>
			<th></th>
			<th></th>
		</tr>
	</thead>
	{% for student in students %}
	<tr {% if student.role == admin %} class="danger" {% endif %}>
		<td>{{ student.role }}</td>
		<td>{{ student.number }}</td>
		<td>{{ student.username }}</td>
		<td>
			<a class="btn btn-default btn-sm" href="{{ url_for('edit_user', id=student.id) }}">
			修改资料
			</a>
		</td>
		<td>
			<a class="btn btn-danger btn-sm {% if student.role==admin %} disabled {% endif %}" href="{{ url_for('remove_user', id=student.id) }}">删除</a>
		</td>
	</tr>
	{% endfor %}
</table>
{% else %}
<p>看来没有符合条件的人</p>
{% endif %}
{% endblock %}